package com.pedromassango.delyo.ui.fragments

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.pedromassango.delyo.R
import com.pedromassango.delyo.ui.gives.GiveAdapter
import com.pedromassango.delyo.ui.gives.Gives
import com.pedromassango.delyo.ui.gives.give
import kotlinx.android.synthetic.main.restaurantfragment.*

class BasketFragment: Fragment() {
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        return inflater.inflate(R.layout.basketfragment, container, false)
    }
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        initdata()
        recycler.layoutManager= LinearLayoutManager(context)
        recycler.adapter= GiveAdapter(give)
    }

    private fun initdata() {
        for(i in 1..10)
        {
            give.add(Gives().apply {
                givename = "salade"
                givedescription = "减肥！！"
                givepicture = R.mipmap.salade
            })
//            food.add(Food().apply {
//                name = "杨枝甘露"
//                description = "清凉解渴！享受果味！沁人心脾！"
//                picture = R.mipmap.yangzhi
//            })
//            food.add(Food().apply {
//                name = "雪王大圣代（奥利奥）"
//                description = "夏天的必需品！便宜实惠冲啊！"
//                picture = R.mipmap.ice
//            })
        }
    }
}